<?php
	$tableName = 'JobCategory';
	$parentId = isset($id)?$id:NULL;
	if(isset($categories)) {
		if(isset($id)){
			$parentId = $id;
		}
		$controller = 'job_categories';
?>

<h1>
	<?php echo $this->Html->link($this->Html->image('assets/icons/dashboard/95.png', array('alt' => 'Edit')),
									'/admin/'.$this->params['controller']. '/' .'add/'. $parentId,  
									array('escape' => false, 'class'=>'tooltip table_icon', 'title' => __('Add New Categories',true), 'rel' => 'add'));
	?>
</h1>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table class="normal">
<thead>
	<tr>
		<th><?php __('Name');?></th>
		<th width="385"><?php __('Description');?></th>
		<th><?php __('Parent');?></th>
		<th><?php __('Published');?></th>
		<th class="actions"><?php __('Actions');?></th>
	</tr>
</thead>
<tbody> 
<?php
	$i = 0;
	foreach ($categories as $location):
		$class = null;
		if ($i++ % 2 != 0) {
			$class = ' class="odd"';
		}
?>
<tr<?php echo $class;?> id="row<?php echo $location['JobCategory']['id']; ?>">
	<td><?php echo $location['JobCategory']['name']; ?>&nbsp;</td>
	<td><?php echo $location['JobCategory']['description']; ?>&nbsp;</td>
	<td><?php echo ($location['ParentJobCategory']['name'] == NULL)?'---':$location['ParentJobCategory']['name']; ?>&nbsp;</td>
	<td>
		<?php
			 if($location['JobCategory']['published'] == 1){
			 	echo $this->Html->image('assets/icons/actions_small/Yes.png', array('alt' => 'Published'));
			 } else{
			 	echo $this->Html->image('assets/icons/actions_small/No.png', array('alt' => 'Not Published'));
			 }
		?>&nbsp;
	</td>
	<td class="actions">
		<?php echo $this->Html->link($this->Html->image('assets/icons/actions_small/Pencil.png', array('alt' => 'Edit')),
										'/admin/'.$this->params['controller']. '/' .'add'.'/'.$location['JobCategory']['id'].'/'. 1,  
										array('rel' => 'edit', 'escape' => false, 'class'=>'tooltip table_icon'));
		?>
		<?php echo $this->Html->link($this->Html->image('assets/icons/actions_small/Trash.png', array('alt' => 'Delete')),
										'/admin/'.$this->params['controller']. '/' .'delete'.'/'.$location['JobCategory']['id'],  
										array('rel' => 'delete', 'escape' => false, 'class'=>'tooltip table_icon'));
		?>
	</td>
</tr>
<?php endforeach;?>
</tbody>
</table>

<?php 		
	}
	echo $this->Javascript->codeBlock('parentId = "'.$parentId.'";');
?>